#! /bin/sh

TIME_ZONE=${TIME_ZONE:-"Asia/Shanghai"}
echo "$TIME_ZONE" > /etc/timezone
ln -sf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime

sed -i "s/listen = 127.0.0.1:9000/listen = \/run\/sock\/php-fpm.sock/" /etc/php7/php-fpm.d/www.conf
sed -i "s/;listen.owner = nobody/listen.owner = nobody/" /etc/php7/php-fpm.d/www.conf
sed -i "s/;listen.group = nobody/listen.group = nobody/" /etc/php7/php-fpm.d/www.conf
sed -i "s/;listen.mode = 0660/listen.mode = 0660/" /etc/php7/php-fpm.d/www.conf
exec php-fpm7 --nodaemonize --fpm-config /etc/php7/php-fpm.conf
